Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Publish releases on Swift Package Registry #778

Open
wants to merge 63 commits into
base: main
Choose a base branch
from
Open

Conversation

jbelkins
Copy link
Contributor

@jbelkins jbelkins commented Jul 10, 2024

Issue #

awslabs/aws-sdk-swift#1553

Description of changes

  • Change smithy-swift back to being distributed via Git
  • Added a version property to service clients so they are aware of their own version & can report it in the user agent
  • Removed parameterization on package manifest name. There is a new Gradle property in the aws-sdk-swift PR for controlling whether package manifests are copied for service clients.
  • A few other minor fixes

Scope

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

val SMITHY_FORM_URL = smithySwiftTargetNamed("SmithyFormURL")
val SMITHY_WAITERS_API = smithySwiftTargetNamed("SmithyWaitersAPI")

private fun smithySwiftTargetNamed(name: String): SwiftDependency {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helper function makes the SwiftDependency declarations above a lot less repetitive.

Also, ignore the version numbers on Swift dependencies for now. A future PR will automatically set them from a configuration file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these smithy-swift SwiftDependencies were also changed so that smithy-swift is a Git dependency, not installed from registry.

"",
"aws-crt-swift",
DistributionMethod.GIT,
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CRT SwiftDependency above is no longer used, and is deleted.

dependencies: [
"ClientRuntime",
"SmithyHTTPAPI",
.product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SmithyTestUtil now needs this dependency on CRT (this was an oversight in the earlier TestInitializer PR.)

@@ -157,7 +157,7 @@ class SwiftWriter(
//
// Also leave out the headers when JSON or the version file is being written,
// as indicated by the file extension.
val isPackageManifest = listOf(PACKAGE_MANIFEST_NAME, (PACKAGE_MANIFEST_NAME + ".swift")).contains(fullPackageName)
val isPackageManifest = PACKAGE_MANIFEST_NAME.contains(fullPackageName)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simpler logic that achieves the same (determining if this file is a package manifest.
There is also a codegen test (see below) to ensure that manifests are written correctly.

@@ -30,6 +30,7 @@ open class HttpProtocolServiceClient(
ClientRuntimeTypes.Core.Client,
) {
writer.write("public static let clientName = \$S", serviceSymbol.name)
writer.write("public static let version = \$S", ctx.settings.moduleVersion)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The client gains this version property, which is used over in the accompanying AWS SDK PR to set the client version in the user agent.

@jbelkins jbelkins marked this pull request as ready for review July 11, 2024 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant